//
//  YDHBaseItemView.h
//  uda-mail-ios
//
//  Created by 刘权 on 2019/8/28.
//  Copyright © 2019 YunDa. All rights reserved.
//

#import <UIKit/UIKit.h>

NS_ASSUME_NONNULL_BEGIN
typedef void (^EnumArrayBlock)(id obj, NSUInteger idx, BOOL *stop);

typedef void (^HeightChangedBlock)(CGFloat height);

@interface YDHBaseItemView : UIView

/// view 数据源
@property(nonatomic, copy, readonly) NSArray* itemViewsArray;

/// 上间距
@property (assign, nonatomic)  CGFloat  margin_top;

/// 下间距
@property (assign, nonatomic)  CGFloat  margin_bottom;

/// 左间距
@property (assign, nonatomic)  CGFloat  margin_left;

/// 右间距
@property (assign, nonatomic)  CGFloat  margin_right;

@property (copy, nonatomic)  HeightChangedBlock heightChangeBlock;

/// 拼接一个子视图
- (void)appendSubView:(UIView *)subView;
/// 在某个子视图后面拼接一个视图
- (void)appendSubView:(UIView *)subView frontView:(UIView *)frontView;
/// 在某个子视图后面拼接一个视图,需要手动调用updateAllSubViewFrame
- (void)appendSubViewWithoutUpdate:(UIView *)subView frontView:(UIView *)frontView;

/// 删除一个子视图
- (void)removeOneItemView:(UIView *)itemView;
/// 删除某个下标的子视图
- (void)removeOnItemViewAtIndex:(NSInteger)index;
/// 删除所有
- (void)removeAllItemViews;

/// 刷新子视图frame
- (void)updateAllSubViewFrame;


@end

NS_ASSUME_NONNULL_END
